|
| Contents | |
| About This Extension |
The Note Effects extension provides methods for easily creating rich sound textures and outrageous sound effects using just musical notes. For example, the playNoteSlide method provides a convenient way to generate musical note "slides", often referred to by musicians as glissandos.
Effects produced using this extension have the following key benefits...
Because these effects are produced programmatically, there is no extra download of music media required. The only extra download required is the tiny Note Effects extension, and after this is downloaded the code required to produce a note effect is less than 100 bytes of text!
Effects produced using this extension can be easily tweaked and tuned to perfection - another advantage of being produced programmatically. For example, if the range of pitches in a note slide produced by the playNoteSlide method is too extreme for your application, simply modify the value of either the StartNoteNumber0to127 or the EndNoteNumber0to127 parameter to reduce the pitch range. If a note slide starts off too shrill because the value specified for the StartNoteNumber0to127 parameter is quite high but you want the slide to start at that pitch, then simply reduce the value of the StartVelocity0to127 parameter so the high pitch of the first notes isn't so harsh on the ears.
Another benefit of note effects produced by this extension is that they can quite easily be made more dynamic than any sound effect that is pre-recorded in a separate music file. Simply add a little randomization to some of the parameters of the methods and you have note effects that don't always sound exactly the same each time they're played.
| What's New in the Latest Version |
There is a dedicated version history for this extension, where you will be able to find out about the new features and possible issues with the most recent version. The version history for this extension is independent of the version history for the core Music Object API.
| Getting This Extension |
To get the "music-object-x-note-effects.js" JavaScript file that implements this extension, simply right-click on this link (click-and-hold for Mac users). Then, from the menu that pops up, select the 'Save Link As...' or 'Save Target As...' option and save the file as "music-object-x-note-effects.js" into an appropriate folder of the local copy of your Web site.
In case you have problems saving the file using the above link, the "music-object-x-note-effects.js" file can also be found inside the documentation's "javascript" folder, along with the "music-object.js" file.
| Dependencies |
In order to use this extension, the following JavaScript file(s) must first be sourced in...
For more information on using extensions, consult the section About Music Object Extensions.
| Reference |
| |||||||
| Instance Methods |
| playNoteSlide |
|
The playNoteSlide method lets you play an ascending or descending series of note pitches over a specified period of time.
| playNoteSlide ( MidiChannel1to16 , BankNumber0to2 , ProgramNumber0to255 , StartNoteNumber0to127orNoteNameSTR , EndNoteNumber0to127orNoteNameSTR , StartVelocity0to127 , EndVelocity0to127 , StartNoteDurationMsINT , EndNoteDurationMsINT , SlideTimeMsINT , NoteIntervalMsINT ) |
MidiChannel1to16 - specifies the MIDI channel on which the note slide should be played
BankNumber0to2 & ProgramNumber0to255 - specifies the bank number and program number of the instrument that should be used to play the notes of the note slide
StartNoteNumber0to127orNoteNameSTR & EndNoteNumber0to127orNoteNameSTR - specifies the starting note pitch and ending note pitch of the range of note pitches that will make up the note slide
StartVelocity0to127 & EndVelocity0to127 - specifies the starting and ending velocities of the range of velocities that will be used for the notes of the note slide
StartNoteDurationMsINT & EndNoteDurationMsINT - specifies the starting duration and ending duration of the range of note durations that will be used for the notes of note slide
SlideTimeMsINT - specifies the amount of time over which all the notes of the note slide will be triggered. For example, specifying a value of 2000 for this parameter will result in a note slide where the last note of the slide is triggered 2 seconds (2000 milliseconds) after the first note of the slide. The SlideTimeMsINT parameter has no relationship to the StartNoteDurationMsINT and EndNoteDurationMsINT parameters. As an example, specifying a value of 2000 for the SlideTimeMsINT parameter and specifying a value of 3000 for the EndNoteDurationMsINT parameter could result in a note slide that sounds for 5 seconds (or more) before fully fading out, depending also upon the release time of the particular instrument being used. Furthermore, if the value of the StartNoteDurationMsINT parameter is greater than the sum of the SlideTimeMsINT and EndNoteDurationMsINT parameters, then the note slide could sound for as long as the duration of the first note of the slide before fully fading out.
NoteIntervalMsINT - specifies the amount of time (measured in milliseconds) between successive notes of a note slide. If the value of this parameter is lower than the value of the StartNoteDurationMsINT or EndNoteDurationMsINT parameters, then notes will overlap at some stage during the note slide. If the value is significantly lower, then there could be a pronounced "piling up" of notes that may result in a dischordant effect. The values of the NoteIntervalMsINT and SlideTimeMsINT parameters will determine the number of notes that make up the slide. For example, specifying a value of 2000 for the SlideTimeMsINT parameter and specifying a value of 1000 for the NoteIntervalMsINT parameter would result in a note slide made up of 3 notes: the first note, another note following 1 second after the first note, and then the final note following 2 seconds after the first note. In another example, specifying a value of 2000 for the SlideTimeMsINT parameter and specifying a value of 100 for the NoteIntervalMsINT parameter would result in a note slide made up of 21 notes. As a rule, the number of notes contained in a note slide can be calculated using the mathematical expression
IMPORTANT: The SlideTimeMsINT parameter takes priority over the NoteIntervalMsINT parameter such that, if the value of the NoteIntervalMsINT parameter is not exactly divisible into the value of the SlideTimeMsINT parameter, then the value of the NoteIntervalMsINT will be adjusted so that it becomes exactly divisible into the SlideTimeMsINT parameter. This is done in such a way as to achieve the same number of complete notes that would have been achieved using the unadjusted NoteIntervalMsINT parameter value. As an example, if the value 2000 were specified for the SlideTimeMsINT parameter and the value 900 were specified for the NoteIntervalMsINT parameter, then the number of complete notes making up the note slide, as calculated by the expression
When no NoteIntervalMsINT parameter is specified, then the default value of 100 is used for this parameter.